package com.hs.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.sfzy.entity.PsyTest;
import com.hs.sfzy.mapper.PsyTestMapper;
import com.hs.sfzy.service.PsyTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName PsyTestServiceImpl
 * @Description TODO
 * @Author wangzhihao
 * @Date 2025年08月18日 11:54
 * @Version 1.0
 */
@Service
public class PsyTestServiceImpl implements PsyTestService {
    @Autowired
    private PsyTestMapper psyTestMapper;
    @Override
    public List<PsyTest> selectById(int userId) {
        return psyTestMapper.selectById(userId);
    }

    @Override
    public PageInfo<PsyTest> selectByName(PsyTest psyTest, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<PsyTest> list = psyTestMapper.selectByName(psyTest);
        PageInfo<PsyTest> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PsyTest selectId(int id) {
        return psyTestMapper.selectId(id);
    }
}
